package com.entity;



import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import javax.persistence.OneToOne;
import javax.persistence.Table;


@Entity
@Table(name="cartltem")
public class Cartltem {
	
	private int id;
	private int count;
    private int price;
    private int state;
	private Product product;
	private Orders orders;
   
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="id")
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	
	@OneToOne
	@JoinColumn(name="pid")
	public Product getProduct() {
		return product;
	}
	public void setProduct(Product product) {
		this.product = product;
		
	}
	@ManyToOne(cascade={CascadeType.PERSIST,CascadeType.MERGE})
	@JoinColumn(name="oid")
	public Orders getOrders() {
			return orders;
		}
	public void setOrders(Orders orders) {
			this.orders = orders;
		}
	@Column(name="count")
	public int getCount() {
		return count;
		
	}
	public void setCount(int count) {
		this.count = count;
	}
	@Column(name="price")
	public int getPrice() {
		return price;
	}
	public void setPrice(int price) {
		this.price = price;
	}
	@Column(name="state")
	public int getState() {
		return state;
	}
	public void setState(int state) {
		this.state = state;
	}
	@Override
	public String toString() {
		return "Cartltem [id=" + id + ", count=" + count + ", price=" + price + ", state=" + state + ", product="
				+ product + ", orders=" + orders + "]";
	}
	
	
}
